<%@ include file="/taglibs.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<head>
<title>北京邮电大学学生党员在线学习中心</title>

<link href="${ctx}/css/site.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/pagination.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	var xmlHttp;

	function changeSecond(value) {
		if (value != -1) {
			var uri = "getChildrenBranchByParentId?parentId=" + escape(value);
			if (window.XMLHttpRequest) {
				xmlHttp = new XMLHttpRequest();
			} else {
				try {
					xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try {
						xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e) {
						alert("不能创建XMLHttpRequest对象!!!");
						return;
					}
				}
			}
			xmlHttp.open("post", uri, true);
			xmlHttp.onreadystatechange = handleResponse;
			xmlHttp.send(null);
		} else {
			clearElement1("secondPa");
		}
	}

	function handleResponse() {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.status == 200) {
				updateSelect("secondPa");
				var idList = xmlHttp.responseXML.getElementsByTagName("id");
				if (idList.length < 1) {
					clearElement1("secondPa");
				} else {
					//clearElement1("thirdPa");
				}
			}
		}
	}

	//根据返回的结果更新党支部信息
	function updateSelect(id) {
		var selectList = document.getElementById(id);
		var idList = xmlHttp.responseXML.getElementsByTagName("id");
		var nameList = xmlHttp.responseXML.getElementsByTagName("name");
		if (idList.length > 0) {
			document.getElementById(id).style.display = "inline";
			clearElement(id);
			selectList.options.add(new Option('请选择党支部', '-1'));
			for ( var i = 0; i < idList.length; i++) {
				selectList.options.add(new Option(
						nameList[i].firstChild.nodeValue,
						idList[i].firstChild.nodeValue));
			}
		} else {
			document.getElementById(id).style.display = "none";
		}

	}

	//清除元素
	function clearElement(id) {
		document.getElementById(id).length = 0;
	}

	//当只有一级或者两级党组织时，需要清理遗留的其他党组织信息
	function clearElement1(id) {
		var selectList = document.getElementById(id);
		clearElement(id);
		selectList.options.add(new Option('请选择党支部', '-1'));
		document.getElementById(id).style.display = "none";
	}
</script>



</head>
<div id="dh_menu">
	<div class="dh_menu_left"></div>
	<div class="dh_menu_right"></div>
	<div class="dh_menu_center">
		<table>
			<tr>
				<s:if test="session.session_user.studentName != null">
					<td style="width: 210px">您好，<s:property
							value="#session.session_user.studentName" />!</td>
				</s:if>
				<td style="width: 15px"><img
					src="${ctx}/images/three_title_icon.gif" />
				</td>
				<td>您当前的位置 >>后台管理>>党组织管理>>党组织查询</td>
			</tr>
		</table>
		<s:if test="session.session_user.studentName != null">
			<div id="logout">
				<a href="${ctx}/logoutAction_adminLogout">[安全退出]</a>
			</div>
		</s:if>
	</div>
</div>
<div style="clear: both; height: 10px;"></div>
<ul id="sideMenuBar">
	<li><a href="${ctx}/Admin_MyBranchAction_listParty">党组织查询</a>
	</li>
	<li><a href="${ctx}/Admin_MyBranchAction_addBranch">新增党组织</a>
	</li>
	<li><a href="${ctx}/Admin_PartyNewsAction_manageCollegeNews">支部公告</a>
	</li>
	<li><a href="${ctx}/Admin_PartyNewsAction_manageCollegeNews">支部活动</a>
	</li>
</ul>

<div id="contentDiv">
	<div align="left">
		<font color="#904146" size=3><b>党组织查询</b>
		</font>
	</div>
	<s:form action="Admin_MyBranchAction_listParty" method ="post" theme="simple">
		<table border="1">
			<tr>
			<tr>
				<td width=25%>请选择党组织：</td>
				<td colspan="3" align="left" width=450px><s:select id="firstPa"
						list="firstPaList" listKey="id" listValue="branchName"
						name="firstPa" headerKey="-1" headerValue="请选择党委"
						onchange="changeSecond(this.value);" value="#request.firstPa" /> 
						<s:select id="secondPa" name="secondPa"
							list="secondPaList"
							listKey="id" listValue="name" headerKey="-1" headerValue="请选择党委"
							value="#request.secondPa" />
					</td>
			</tr>

		</table>
		<br />
		<div align="center">
			<input type="submit" name="button" id="button" value="查询" />
		</div>


		<br />

		<table width="97%" height="500" border=1;>
			<tr bgcolor="#F1F4FB">
				<th align="center">党组织名称</th>
				<th align="center">书记</th>
				<th align="center">党员人数</th>
				<th align="center">操作</th>

			</tr>
			<s:iterator value="children" status ="st">
				<tr>
				<td><s:property value="branchName"/>
				</td>
				<td><s:property value="branchSecretaryName"/>
				</td>
				<td><s:property value=""/></td>
				<td><a href="${ctx}/Admin_MyBranchAction_updateBranch?id=<s:property value="id"/>">修改</a>
				<a href="${ctx}/Admin_MyBranchAction_deleteBranch?id=<s:property value="id"/>">删除</a></td>
				</tr>
			</s:iterator>
			
		</table>

		<Br />

		</s:form>
		
<div style="clear:both; height:10px;"></div>

<div style="margin-left:0; text-align: center;">
		<s:property value="paginationCode" escape="false"/>
</div>

</div>